
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="../css/popup.css"/>
        <link rel="stylesheet" type="text/css" href="../css/kapiform.css"/>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/jq.date.js"></script>  
        <link rel="stylesheet" type="text/css" href="../css/ui.datepicker.css"/>
        <script type="text/javascript">
            var open_cur = 0;
            $j = jQuery.noConflict();
           
            $j(document).ready(function(){
                
                $j('.keysearch').live('keyup',function(){
                    $j('.rich-table-row').hide();
                    $j('.rich-table-row').each(function(){
                        html = $j(this).html();
                        // alert( ununicode(html));  || html.indexOf( $j('.keysearch').val()) > -1 
                        if(ununicode(html).indexOf(ununicode($j('.keysearch').val())) > -1    )  {
                            $j(this).show();
                        }else{
                            $j(this).hide();
                        }

                    });
                });
                var PN100 = $j('#form-input-customer\\:pn100').val();
                  
                $j('input#dateStart, input#dateEnd').datepicker({ dateFormat: 'dd/mm/yy', showOn: 'button', buttonImage: '../images/calenda_icon.gif', buttonImageOnly: true }); 
                $j('.header-box').live('click', function(){  
                    $j('.mesage').text('');
                    if($j(this).next('.customer-box').css('display') != 'none'){
                        return;
                    }else{
                        if(PN100 ==0){
                            PN100  =$j('.pn100lang').attr("lang");
                           
                        }
                        
                        if(PN100 != 0)
                        {
                            $j('.messa').hide();
                            $j('.customer-box').slideUp();                         
                            $j('.boder-bomttom').removeClass('boder-bomttom');
                            $j(this).next('.customer-box').slideDown();
                            $j(this).addClass('boder-bomttom');
                        } else{
                        
                            $j('.messa').show();
                            $j(this).next('.customer-box').css('display') != 'none'
                        }
                           
                    }

                });
                var b = location.pathname;
                $j("input[id$='message']").val(b);
                //validateform("job");
                
                $j('input#leavedate2').datepicker({ dateFormat: 'dd/mm/yy', showOn: 'button', buttonImage: '../images/calenda_icon.gif', buttonImageOnly: true }); 
                $j('input#leavedate3').datepicker({ dateFormat: 'dd/mm/yy', showOn: 'button', buttonImage: '../images/calenda_icon.gif', buttonImageOnly: true }); 
                $j('input#date').datepicker({ dateFormat: 'dd/mm/yy', showOn: 'button', buttonImage: '../images/calenda_icon.gif', buttonImageOnly: true }); 
                        

                //  validateform("form-input-customer");
                $j('input#dateStart,input#dateStart1, input#dateEnd1').datepicker({ dateFormat: 'dd/mm/yy', showOn: 'button', buttonImage: '../images/calenda_icon.gif', buttonImageOnly: true }); 
                $j('.passport, .cmnd, .place_of_issue, .place_of_issue1').attr('disabled', true);
                $j('input#dateStart1,input#dateEnd1,input#dateStart').datepicker("disable");
            
                if($j('.checkCmnd').is(':checked')){
                    $j('.cmnd, .place_of_issue').attr('disabled', false); 
                    $j(".alert2").text("");
                    $j('input#dateStart').datepicker("enable");
                }
               
                var pagee = $j("#form-input-customer\\:FK400E").val();
                $j('#fancybox-close').live('click', function(){
                 
                    if(pagee ==11){
                        window.location.href="supplier.jsp";
                    }else{
                        window.location.href="cuscompany.jsp";
                    }
                   
                });
                $j('.closeform').live('click', function(){
                    var pagee = $j("#form-input-customer\\:FK400E").val();
                   
                    if(pagee ==11){
                        window.location.href="supplier.jsp";
                    }else{
                        window.location.href="cuscompany.jsp";
                    }
                });
                $j(".more_detail_vh").live("click",function(){
                    //  alert($j(this).parent(".customer-box").find(".popup-footer").attr("class"));
                    $j(".more_detail_vh_down").css("display","block");
                    $j(".more_detail_vh").css("display","none");
                    $j(".morevh").css("display","block");
                    $j(this).parent(".customer-box").css("height","380px");
                    $j(this).parent(".customer-box").find(".popup-footer").css("margin-top","60px");
                });
                $j(".more_detail_vh_down").live("click",function(){
                    //  alert($j(this).parent(".customer-box").find(".popup-footer").attr("class"));
                    $j(".more_detail_vh").css("display","block");
                    $j(".more_detail_vh_down").css("display","none");
                    $j(".morevh").css("display","none");
                    $j(this).parent(".customer-box").css("height","234px");
                    $j(this).parent(".customer-box").find(".popup-footer").css("margin-top","5px");
                });
                $j(".l200").live("click",function(){                   
                    $j.post("l200Edit.jsp?action=edit&pn100E="+PN100,function(data){
                        
                              
                    });
                });
                
                $j('.buttonsave1').live('click',function(){
                    $j('.fromsearch').css('display', 'none');
                    $j('#searchEm').css('display', 'none');
                    $j('.addEm').css('display', 'block');
                    $j(this).css('display', 'none');
                    $j('.buttonsave2').css('display', 'block');
                    $j('.buttonsave3').css('display', 'none');
                    
                });
                $j('.buttonsave3').live('click',function(){
                    $j('.fromsearch').css('display', 'none');
                    $j('#searchEm').css('display', 'none');
                    $j('.addEm').css('display', 'none');
                    $j('.addPersonDD').css('display', 'block');
                    $j(this).css('display', 'none');
                    $j('.buttonsave2').css('display', 'block');
                    $j('.buttonsave1').css('display', 'none');
                });
                
               
                $j(".keysearch").live("click",function(){
                    $j(".keysearch").val("");
                
                  
                });
                $j(".selectedp").live("change",function(){  
                    $j(".mesage").text("");
                    if($j(this).is(':checked')){
                        $j(this).parent().parent(".rich-table-row").find(".selected").css("display","none");
                        pn100 = $j(this).attr("lang");
                        fk100 = $j("#formPesonal\\:FK100").val();                             
                      
                        // showPleaseWait();
                        $j.post("actionCompany.jsp?action=updateFK100TN100&fk100="+fk100+"&pn100="+pn100,function(data){
                            if(data!= null){
                                $j(".mesage").text("Cập nhật thành công !");
                                //  hidePleaseWait();
                            }
                        });
                    
                    }else{
                        pn100 = $j(this).attr("lang");
                        fk100 = $j("#formPesonal\\:FK100").val();        
                       
                        // showPleaseWait();
                        $j.post("actionCompany.jsp?action=updateFK100TN100&fk100="+442+"&pn100="+pn100,function(data){
                            if(data!= null){
                                $j(".mesage").text("Cập nhật thành công !");
                                //  hidePleaseWait();
                            }
                        });
                        $j(this).parent().parent(".rich-table-row").find(".selected").css('display', "block");
                    }
                    
                  
                });
                $j(".selected").live("change",function(){ 
                    $j(".mesage").text("");
                    if($j(this).is(':checked')){
                        $j(this).parent().parent(".rich-table-row").find(".selectedp").css("display","none");
                        pn100 = $j(this).attr("lang");
                        fk100 = $j("#formPesonal\\:FK100").val();            
                        if(fk100 == 0){
                            return false;
                        }
                        //showPleaseWait();
                        $j.post("actionCompany.jsp?action=updatemorecompany&fk100="+fk100+"&pn100="+pn100,function(data){
                            if(data!= null){
                                $j(".mesage").text("Cập nhật thành công !");
                                // hidePleaseWait();
                            }
                        });
                    }else{
                        pn100 = $j(this).attr("lang");
                       
                        fk100 = $j("#formPesonal\\:FK100").val();     
                       
                        //showPleaseWait();
                        $j.post("actionCompany.jsp?action=updatemorecompany&fk100="+442+"&pn100="+pn100,function(data){
                            if(data!= null){
                                $j(".mesage").text("Cập nhật thành công !");
                                // hidePleaseWait();
                            }
                        });
                        $j(this).parent().parent(".rich-table-row").find(".selectedp").css('display', "block");
                    }
                   
                  
                });
                
                $j(".typeCombobox").live("change",function(){
                    fk200 = $j(this).val();
                    $j.post("actionCutomer.jsp?action=select&fk200="+fk200,function(data){
                        
                    });
                });
                $j(".checkHide").live("change",function(){
                    if($j(this).is(':checked')){
                        
                        $j(this).prev().css('display','block');
                        $j(this).prev().prev().css('display','none');
                    }else{
                        
                        $j(this).prev().css('display','none');
                        $j(this).prev().prev().css('display','block');
                    }
                });
                
              
            });

        </script>
        <style type="text/css">
            .fast_search1 input[type="text"] {
                border: 1px solid #138EF9;

                float: left;
                height: 26px;
                width: 300px;
            }
            .buttonsearch{

            }
            .bg_department{
                height: 68px !important;
            }
            /*            .popup-content .main_content .form_item_content .edit_form_left .fields_input {
                            float: left;
                            margin-top: 0px !important;
                            width: 100%;
                        }
                        .popup-content .main_content .form_item_content .edit_form_right .fields_input {
                            float: left;
                            margin-top:  0px !important;
                            width: 100%;
                        }
                        .popup-content .main_content .form_item_content .edit_form_center {
                            float: left;
                            height: 53px;
                            margin-left: 26px;
                            width: 100%;
                        }
                        .popup-content .main_content .form_item_content .fields_input {
                            float: left;
                            margin-top: 0 !important;
                            width: 100%;
                        }
            
                        .popup-content .main_content .form_item_content {
                            margin-top:0px !important;
                        }*/
            .feild_sex td label{
                color:#4C4C4C;
            }
            #ui-datepicker-div
            {
                z-index: 9999999;
            }
            #fancybox-wrap{

            }
            .addPersonDD{
                float:left;
                margin-top:10px;
                display:none;
            }
            .mesage {
                color: red;
                float: left;
                margin-left: 252px;
                margin-top: 20px;
                text-transform: uppercase;
            }
            /*            .fields_input{
                            float:left;
                            width:100%;
                            margin-top:0px !important;
                            height:28px;
                        }*/
            .button-link{
                border:0;
                background:url(../images/bg_submit.gif) repeat-x;
                width:134px;
                float:right;
                margin:19px 0 10px 0;
                color:#ffffff;
                font-size:14px;
                font-weight:bold;
                cursor:pointer;
                border-radius:5px;
                box-shadow:0 2px 3px #666666;
                padding:8px 0;
                text-transform:uppercase;
            }
            .customer-box{
                float:left; width:720px; margin-left:25px;
                border:1px solid #CCCCCC;
                padding:18px 0px 10px 0px;
                background: #E5E8EA;
                border-top: none;

            }
            .customer-box label{
                width:130px;
                text-align: right;
                float:left;
            }
            .header-box {
                background: none repeat scroll 0 0 #D4D7D8;
                border: 1px solid #CCCCCC;
                color: #263340;
                cursor: pointer;
                float: left;
                font-size: 12px;
                font-weight: bold;
                height: 21px;
                margin-left: 25px;
                margin-top: 10px;
                padding: 4px 0 0 4px;
                width:716px; border:1px solid #CCCCCC;

            }
            input{
                float:left;
                margin-left:9px;
            }
            select{
                float:left;
                height: 21px;
                width:166px;
                margin-left:9px;
            }
            .ui-datepicker-header select{
                width:45% !important;
            }
            /*            .header-box{
                            margin-left:25px;
                            color:#263340;
                            margin-top:15px;
                            float: left;
                            cursor:pointer; padding:4px 0px 0px 4px; width:716px; border:1px solid #CCCCCC;
                           font-size:14px;
                            background: #D4D7D8;
                            height: 21px;
                        }*/
            .fixdate .ui-datepicker-trigger  { margin-left: 4px;}

            .boder-bomttom{}


            .buttonsearch2{
                border:0;
                background:url(../images/bg_submit.gif) repeat-x;
                width:68px;

                margin:0px 0 10px 20px;
                color:#ffffff;
                font-size:12px;
                font-weight:bold;
                cursor:pointer;
                border-radius:2px;
                padding:4px 0;
                text-transform:uppercase;
            }
            img.ui-datepicker-trigger {
                cursor: pointer;
                height: 17px;
                position: relative;
                width: 17px;
            }
            .message{
                color: red;
                float: left;
                margin-left: 290px;
                margin-top: 28px;

            }
            .message3{
                color: red;
                float: left;
                margin-left: -45px;
                margin-top: 23px;
                text-transform: uppercase;
            }
            .morevh{
                display:none;
            }
            .more_detail_vh{
                color: #0C70D3;
                cursor: pointer;
                float: right;
                margin-right: 35px;
                margin-top: -10px;
            }
            .more_detail_vh_down{
                color: #0C70D3;
                cursor: pointer;
                float: right;
                margin-right: 35px;
                margin-top: -10px;
                display: none;
            }
            .activeedit{
                display:block !important;
            }


            .addEm{
                display: none;
                margin-top:10px;
                float:left;
            }
            .buttonsave1{
                margin-top: -35px;
            }

            .buttonsave1,.buttonsave3 {
                background: url("../images/button_left.gif") repeat-x scroll 0 0 transparent;
                border: 0 none;
                color: white;
                cursor: pointer;
                float: left;
                font-size: 10px;
                font-weight: bold;
                height: 13px;

                margin-left: 11px;
                padding: 4px 7px;
                text-transform: uppercase;
                width: auto;
            }
            .buttonsave2 {
                background: url("../images/button_left.gif") repeat-x scroll 0 0 transparent;
                border: 0 none;
                color: white;
                cursor: pointer;
                float: left;
                font-size: 10px;
                font-weight: bold;
                height: 13px;
                display: none;
                margin-left: 11px;
                padding: 4px 7px;
                text-transform: uppercase;
                width: auto;
            }
            .fromsearch{
                float: left;
                width:100%;
                height: 30px;
                margin-bottom: 7px;
            } .resultSearch{
                margin-bottom: 10px;
                display: block;
            }
            .lbl_trans{
                padding-top: 10px;
            }
            .div_notice{
                width:100%;
                float:left;
                margin-top: 8px;
            }
            .select_cus{
                float: left;
                margin-top: 10px;
                width: 228px; 
            }
            .select_cus td label{
                width: 79px !important;
                margin-left: 3px;
            }
            .lbl_comName{
                margin-top: 2px;
            }
            .cbx_career{
                height: 22px;
                line-height: 22px;
            }
            .cus_select{
                float: left;
                margin-bottom: 10px;
                margin-top: 2px;
                width: 228px;
            }
            .cityyy{
                display: none;
            }
        </style>
    </head>

    <f:view>

        <body style=" float:left;">
            <f:loadBundle basename="#{environmentSession.localizationSource}" var="locale"/>


            <div class="popup" style="height:auto; width:770px">
                <div class="popup-header">
                    <div class="title"><h:outputText value="Thêm KH công ty"/></div>
                </div>

                <div class="popup-content">
                    <a4j:form id="form-input-customer" >
                        <h:inputHidden value="#{k100Controller.fk400}" id="FK400E"/>
                        <!-- Thông tin cơ bản ------------------------------------>
                        <span  class="header-box boder-bomttom" ><h:outputText value="Thông tin cơ bản" lang="#{k100Controller.PK100}" id="pn100lang" styleClass="pn100lang"/></span>
                        <div class="customer-box" style="" lang="<h:outputText value="#{k100Controller.PK100}"/>" >
                            <div class="fields_input" style="width:100%;float: left;margin-bottom: 7px;">
                                <label class="lbl_comName"><h:outputText value="Tên công ty"/> *:</label>&nbsp;
                                <h:inputText style="width:518px !important;" value="#{k100Controller.KV103}" onkeyup="this.value=this.value.toUpperCase();">
                                </h:inputText>

                            </div>
                            <div class="form-left" style="margin-left: 25px;">
                                <%--  <div class="fields_input">
                                    <label><h:outputText value="Loại hình" />:</label>&nbsp;
                                    <h:selectOneMenu value="#{k100Controller.FK350}" styleClass="typeCombobox">
                                        <f:selectItem itemValue="1" itemLabel="Khách hàng công ty"/>
                                        <f:selectItem itemValue="2" itemLabel="Nhà cung cấp"/>

                                        <a4j:support event="onchange" reRender="cus_check"/>
                                    </h:selectOneMenu>
                                    <h:inputHidden value="#{k100Controller.tip}" id="tip"/>
                                </div>

                                --%>
                                <div class="fields_input">
                                    <label class="lbl_trans"><h:outputText value="Tên giao dịch"/>:</label>&nbsp;
                                    <h:inputText value="#{k100Controller.KV106}" id="middlename" >
                                        <h:message for="middlename"/>
                                    </h:inputText>

                                </div>
                                <div class="fields_input">
                                    <label class="lbl_trans"><h:outputText value="Mã số thuế"/>:</label>&nbsp;
                                    <h:inputText value="#{k100Controller.KV108}" id="mst" >

                                    </h:inputText>

                                </div>
                                <div class="fields_input" >
                                    <label ><h:outputText value="Quốc gia" />:</label>&nbsp;
                                    <h:selectOneMenu styleClass="coutryyy" value="#{k100Controller.FN750}" >
                                        <f:selectItems value="#{k100Controller.listCoutry}" />  
                                    </h:selectOneMenu>
                                    <%--        <h:selectOneMenu styleClass="cityyy" value="#{k100Controller.FN750}" >
                                                <f:selectItems value="#{k100Controller.listCity}" />  
                                            </h:selectOneMenu>
                                            <h:selectBooleanCheckbox styleClass="checkHide" style="float:left;" title="Việt Nam" value=""/> --%>
                                </div>
                            </div>


                            <div class="form-right">
                                <%--  <h:panelGroup id="cus_check">
                                    <div class="fields_input" style="display: <h:outputText rendered="#{k100Controller.tip != 1}" value="none"/><h:outputText rendered="#{k100Controller.tip == 1}" value="block"/> ">
                                        <h:panelGroup rendered="#{k100Controller.tip == 1}">
                                            <label>Khách hàng :</label>
                                            <h:selectBooleanCheckbox styleClass="select" value="#{k100Controller.select}"  style="width=10px;margin-top: 2px;">

                                            </h:selectBooleanCheckbox>
                                        </h:panelGroup>
                                    </div>
                                </h:panelGroup> --%>
                                <div class="fields_input">
                                    <label><h:outputText value="#{locale.career}"/>: </label>

                                    <h:selectOneMenu id="n550CC" value="#{k100Controller.FN550}"  styleClass="combobox" style="width:167px;">
                                        <f:selectItems value="#{k100Controller.combN550CC}"></f:selectItems> 
                                    </h:selectOneMenu>

                                    <h:inputHidden id="pnPK1001" value="#{k100Controller.PK100}" />
                                    <h:inputHidden id="pnKV1021" value="#{k100Controller.KV102}" />
                                    <h:inputHidden id="pnKV1101" value="#{k100Controller.KV110}" />
                                </div>

                                <div class="fields_input">
                                    <label ><h:outputText value="Nguồn" />:</label>&nbsp;

                                    <h:selectOneMenu  value="#{k100Controller.FK300}" >
                                        <f:selectItems  value="#{k330Controller.comboK300}"/>
                                    </h:selectOneMenu>                                
                                </div>

                                <div class="fields_input" >
                                    <label ><h:outputText value="Trạng thái" />:</label>&nbsp;

                                    <h:selectOneMenu value="#{k100Controller.FK330}" >
                                        <f:selectItems value="#{k330Controller.comboK330}"/>
                                    </h:selectOneMenu>

                                </div>                                                                                              
                            </div>
                            <div  class="div_notice">
                                <label><h:outputText value="#{locale.notice1}"/>:</label>
                                <h:inputTextarea value="#{k100Controller.KV101}" cols="20" style="margin-left: 9px;width: 518px;" ></h:inputTextarea>
                                </div>
                                <div class="popup-footer" style="height:40px;">
                                <h:outputText value="#{k100Controller.messagecom}" id="mesage" styleClass="mesage"/>
                                <h:inputHidden id="pn100" value="#{k100Controller.PK100}"/>
                                <h:inputHidden id="FK350" value="#{k100Controller.FK350}"/>
                                <h:inputHidden id="FK200" value="#{k100Controller.FK200}"/>
                                <h:inputHidden id="KN114" value="#{k100Controller.KN114}"/>
                                <a4j:commandButton style="margin-right:31px;"  value='#{locale.save}' actionListener="#{k100Controller.saveK100}"
                                                   onclick="showPleaseWait();$j('.mesage').text('');"
                                                   oncomplete="hidePleaseWait();"
                                                   styleClass="buttonsave" reRender="mesage,pn100,pn100lang">

                                </a4j:commandButton>

                            </div>
                            <!-- End List Content-->
                        </div>
                    </a4j:form>


                    <a4j:form>

                        <span class="header-box contactN950C"><h:outputText value="#{locale.contact_info}"/></span>
                        <div class="customer-box" style="display:none;">
                            <div class="customer-boxcontact">
                                <!-- Danh cho from contact N950 ------------------------------------------>
                               
                            </div>

                        </div>


                    </a4j:form>

                    <!-- Tài khoản ------------------------------->    

                    <a4j:form id="formAccount">
                        <span class="header-box acountT025C" ><h:outputText value="#{locale.bank_account}"/></span>

                        <div class="customer-box" style="display:none">

                            <div class="customer-boxacount">
                                <!-- Danh cho from contact N950 ------------------------------------------>
                               
                            </div>
                        </div>

                    </a4j:form>

                    <a4j:form id="formOther">
                        <span class="header-box otherinfoC" ><h:outputText value="Thông tin khác"/></span>

                        <div class="customer-box" style="display:none">

                            <div class="customer-boxother">
                                <!-- Danh cho from contact N950 ------------------------------------------>
                            </div>
                        </div>

                    </a4j:form>
                    <%--
                <a4j:form id="formPesonal" >
                    <!-- Thông tin cơ bản ------------------------------------>
                    <span  class="header-box boder-bomttom empCOMP" ><h:outputText value="Danh sách nhân viên"/></span>
                    <div class="customer-box formPesonal" style="display:none;">

                        </div>
                    </a4j:form>--%>
                    <div class="messa" style=" margin-left: 89px;margin-top: 330px !important;padding-top:5px;padding-bottom: 5px;">                                
                        <h:outputText id="message" value="Xin vui lòng lưu công ty !" style="display:none;margin-left:200px;color:red;font-weight:bold;font-style:italic;" styleClass="messa"/>
                    </div>

                </div>


                <div class="popup-footer">
                    <div class="buttonsave closeform" style="margin-right:33px;"  ><span><h:outputText value="#{locale.close}"/></span></div>
                </div>    
            </div>
        </body>

    </f:view>
</html>
<script type="text/javascript">
    $j(document).ready(function(){
        yhight = ($j('.popup').height()-90)+"px" ;
        $j('.main_content').css('height',yhight );
        $j('.popup-content').css('height',yhight );
    });
</script>